package zk.weart.core.response;

import lombok.Data;


/**
 * @author scjia
 */
@Data
public class ResultData {

    Integer code;

    String message;

    Object data;


    public ResultData() {
    }

    public ResultData(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public ResultData(Integer code, String message, Object data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public ResultData(Integer code, Object data) {
        this.code = code;
        this.data = data;
    }

    public static ResultData success(){

        return  new ResultData(ResultCode.success,ResultMessage.success);
    }

    public static ResultData success(Object data){

        return  new ResultData(ResultCode.success,data);
    }


    public static ResultData fail(Object data){

        return  new ResultData(ResultCode.fail,data);
    }

    public static ResultData error(Object data){

        return  new ResultData(ResultCode.error,data);
    }

    public static ResultData error(){

        return  new ResultData(ResultCode.error,ResultMessage.error);
    }

}
